package W072_081.src.dao;

import W072_081.src.entity.School;
import W072_081.src.factory.DaoFactory; // 确保 DaoFactory 的导入语句正确
import W072_081.src.util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;

public class SchoolService {
    private SchoolDaoImpl schoolDaoImpl = (SchoolDaoImpl) DaoFactory.getDao(SchoolDaoImpl.class, "SchoolDaoImpl");

    public boolean add(School school) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        boolean added = schoolDaoImpl.add(connection, school);
        JdbcHelper.close(connection);
        return added;
    }
}